# 第一题
# 1）进入http://www.sogou.com

# import time
#
# from day2selenium import webdriver
# from day2selenium.webdriver.common.by import By
#
# l = webdriver.Edge()
# l.get("http://www.sogou.com")
# time.sleep(4)
# # 2）点击图片进入图片网页
# b = l.find_element("id","pic")
# b.click()
# time.sleep(2)
# # 3）控制台打印下图中的a标签文字
# a = l.find_elements(By.TAG_NAME,"a")
# print(a)
# for ae in a[:12]:
#      print(ae.text)
# 第二题
# 打开然知系统网页：http://127.0.0.1/ranzhi/www/
# 1)输入用户名和密码功能  admin 123456

import time

from selenium import webdriver
from selenium.webdriver.common.by import By

l = webdriver.Edge()
l.get("http://127.0.0.1/ranzhi/www/")
time.sleep(5)
# 2)点击登陆按钮
text = l.find_element(By.ID,"account") # 获取元素 文本编辑框
# 给文本编辑框编辑信息
text.send_keys("admin")
text = l.find_element(By.ID,"password")
text.send_keys("123456")
button = l.find_element(By.ID,"submit")
button.click() # 点击按钮
time.sleep(5)
# 3)点击后台管理按钮
button = l.find_element(By.XPATH,"/html/body/div[1]/div[1]/div/ul[1]/li[8]/button")
button.click() # 点击按钮
time.sleep(5)